<template>
  <a-spin :spinning="confirmLoading">
    <j-form-container :disabled="false">
      <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
        <a-row :gutter="48">
          <!--<a-col :span="8">
            <a-form-model-item label="团队编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tdbh">
              <a-input :disabled="formDisabled" v-model="model.tdbh" placeholder="请输入团队编号"  ></a-input>
            </a-form-model-item>
          </a-col>-->
          <a-col :span="8">
            <a-form-model-item label="单据编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tdbh">
              <a-input :disabled="formDisabled" v-model="model.tdbh" placeholder="请输入单据编号" disabled></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="团队名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tdmc">
              <a-input :disabled="formDisabled" v-model="model.tdmc" placeholder="请输入团队名称"></a-input>
            </a-form-model-item>
          </a-col>
          <!-- <a-col :span="8">
            <a-form-model-item label="团队年度" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tdnd">
              <j-dict-select-tag :disabled="formDisabled" type="list" v-model="model.tdnd" dictCode="tdnd_type"
                                 placeholder="请选择团队年度"/>
            </a-form-model-item>
          </a-col> -->

          <a-col :span="8">
            <a-form-model-item label="团队类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tdlx">
              <j-multi-select-tag :disabled="formDisabled" v-model="model.tdlx" dictCode="tdlx_type"
                                 placeholder="请选择团队类型"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="业务类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="businessType">
              <j-multi-select-tag :disabled="formDisabled" v-model="model.businessType" dictCode="erp_files_business_category,category_name,id,level='1'"
                                 placeholder="请选择业务类型"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="上级团队" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="parentId">
              <!--<a-input :disabled="formDisabled" v-model="model.tdfg" placeholder="请输入团队分管"  ></a-input>-->
              <select-team-input
                query-type="'all'"
                :allowClear="true"
                :disabled="formDisabled"
                v-model="model.parentId" :tdlx="3"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <div v-if="!model.parentId">
            <a-form-model-item label="归属公司" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="belongCompanyId">
              <select-Company-input   :disabled="formDisabled" v-model="model.belongCompanyId" />
            </a-form-model-item>
            </div>
          </a-col>
          <!-- 迭代3.5隐藏主表团队负责人团队分管领导字段 -->
          <!-- <a-col :span="8">
            <a-form-model-item label="团队负责人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tdfzr">
              <select-user-by-dep
                :disabled="formDisabled"
                v-model="model.tdfzr" :normalData="true"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="团队分管领导" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tdfg">
              <select-user-by-dep
                :disabled="formDisabled"
                v-model="model.tdfg" :multi="true" placeholder="请选择团队分管领导" :normalData="true"/>
            </a-form-model-item>
          </a-col> -->
          

<!--          <a-col :span="8">-->
<!--            <a-form-model-item label="项目部" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="xmb">-->
<!--              <a-input :disabled="formDisabled" v-model="model.xmb" placeholder="请输入项目部"></a-input>-->
<!--            </a-form-model-item>-->
<!--          </a-col>-->
<!--          <a-col :span="8">-->
<!--            <a-form-model-item label="实验室" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sys">-->
<!--              <a-input :disabled="formDisabled" v-model="model.sys" placeholder="请输入实验室"></a-input>-->
<!--            </a-form-model-item>-->
<!--          </a-col>-->
<!--          <a-col :span="8">-->
<!--            <a-form-model-item label="综合技术" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="zhjs">-->
<!--              <a-input :disabled="formDisabled" v-model="model.zhjs" placeholder="请输入综合技术"></a-input>-->
<!--            </a-form-model-item>-->
<!--          </a-col>-->
          <a-col :span="8">
            <a-form-model-item label="资金总额(元)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="zjje">
              <a-input-number :disabled="formDisabled" :max="99999999" :min="0" :precision="2"
                              v-model="model.zjje" placeholder="请输入资金总额(元)" style="width: 100%"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="备用金(元)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="byj">
              <a-input-number :disabled="formDisabled" :max="99999999" :min="0" :precision="2"
                              v-model="model.byj" placeholder="请输入备用金(元)" style="width: 100%"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="预入金额(元)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="yrje">
              <a-input-number :disabled="formDisabled" :max="99999999" :min="0" :precision="2"
                              v-model="model.yrje" placeholder="请输入预入金额(元)" style="width: 100%"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="预提金额(元)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ytje">
              <a-input-number :disabled="formDisabled" :max="99999999" :min="0" :precision="2"
                              v-model="model.ytje" placeholder="请输入预提金额(元)" style="width: 100%"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="已用金额(元)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="yyje">
              <a-input-number :disabled="formDisabled" :max="99999999" :min="0" :precision="2"
                              v-model="model.yyje" placeholder="请输入已用金额(元)" style="width: 100%"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="可用金额(元)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="kyje">
              <a-input-number :disabled="formDisabled" :max="99999999" :min="0" :precision="2"
                              v-model="model.kyje" placeholder="请输入可用金额(元)" style="width: 100%"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="剩余金额(元)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="syje">
              <a-input-number :disabled="formDisabled" :max="99999999" :min="0" :precision="2"
                              v-model="model.syje" placeholder="请输入剩余金额(元)" style="width: 100%"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="累计报告合同金额(元)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ljhtbgje">
              <a-input-number :disabled="formDisabled" :max="99999999" :min="0" :precision="2"
                              v-model="model.ljhtbgje" placeholder="请输入累计报告合同金额(元)" style="width: 100%"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="上缴利润比例(%)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sjlrbl">
              <a-input-number  :disabled="formDisabled" :max="99999999" :min="0" :precision="2" v-model="model.sjlrbl" placeholder="请输入上缴利润比例" style="width: 100%"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="上缴管理费比例(%)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sjglfbl">
              <a-input-number  :disabled="formDisabled" :max="99999999" :min="0" :precision="2" v-model="model.sjglfbl" placeholder="请输入上缴管理费比例" style="width: 100%"/>
            </a-form-model-item>
          </a-col>
<!--          <a-col :span="8">-->
<!--            <a-form-model-item label="公共业务" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ggyw">-->
<!--              <j-dict-select-tag :disabled="formDisabled" type="radio" v-model="model.ggyw" dictCode="yn"-->
<!--                                 placeholder="请选择公共业务"/>-->
<!--            </a-form-model-item>-->
<!--          </a-col>-->
          <a-col :span="8">
            <a-form-model-item label="状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="zt">
              <j-dict-select-tag :disabled="formDisabled" type="radio" v-model="model.zt" dictCode="status_type" placeholder="请选择状态"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="申请人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="proposer">
              <select-user-by-dep
                v-model="model.proposer"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="申请日期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="createTime">
              <j-date placeholder="请选择日期" v-model="model.createTime" :show-time="true"
                      date-format="YYYY-MM-DD HH:mm" style="width: 100%" disabled/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="申请部门" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="proposerDeptId">
              <j-select-depart disabled v-model="model.proposerDeptId"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="团队类别" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="teamType">
              <j-dict-select-tag :disabled="formDisabled" type="list" v-model="model.teamType" dictCode="team_type" placeholder="请选择团队类别" />
            </a-form-model-item>
          </a-col>
          <template v-if="false">
            <a-divider style="top:20px;" >基本信息</a-divider>
            <a-col :span="24" style="margin-bottom: 24px;">
              <div style="margin-bottom: 6px;margin-top: 6px">
                <a-button @click="handleAdd4" v-if="!formDisabled" type="primary">新增</a-button>
              </div>
              <a-table
                ref="table"
                size="middle"
                rowKey="id"
                :loading="loading"
                :columns="columns4"
                :pagination="pagination"
                :data-source="dataSource4">
                  <span slot="action" slot-scope="text, record">
                    <template v-if="!disabled">
                      <!-- {{record.auditStatus}} -->
                      <a @click="handleDelete4(record)" v-if="record.auditStatus === '0'">删除</a>
  <!--                    <a-divider type="vertical"/>-->
  <!--                    <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete4(record.id)">
                        <a>删除</a>
                      </a-popconfirm>-->
                    </template>
                  </span>
              </a-table>
            </a-col>
          </template>
        </a-row>

        <a-collapse v-model="activeKey">
          <a-collapse-panel key="1" header="管理机构负责人">
            <a-row>
              <ErpOmcTeamManagerDetailList ref="managementPerson" roleType="government" :mainId="model.id" :disabled="formDisabled"></ErpOmcTeamManagerDetailList>
            </a-row>
          </a-collapse-panel>
          <a-collapse-panel key="2">
            <p slot="header" style="margin-bottom: 0px;"><span style="color:red; margin-right: 4px;">*</span>团队负责人</p>
            <a-row>
              <ErpOmcTeamManagerDetailList ref="teamPerson" roleType="head" :mainId="model.id" :disabled="formDisabled"></ErpOmcTeamManagerDetailList>
            </a-row>
          </a-collapse-panel>
          <a-collapse-panel key="3" header="团队分管负责人">
            <a-row>
              <ErpOmcTeamManagerDetailList ref="teamResponsibilitiesPerson" roleType="responsibilities" :mainId="model.id" :disabled="formDisabled"></ErpOmcTeamManagerDetailList>
            </a-row>
          </a-collapse-panel>
          <a-collapse-panel v-if="disabled && teamLeve === '1'" key="4" header="团队审批人员">
            <a-row>
              <!-- <ErpCompanyEmployeePostDetailList ref="detailList" :disabled="false" :companyId="id" normal></ErpCompanyEmployeePostDetailList> -->

              <ErpTeamApproval ref="ErpTeamApprovals" :companyId="id"  :disabled="false" normal></ErpTeamApproval>
            </a-row>
          </a-collapse-panel>
        </a-collapse>
      </a-form-model>

      <erp-omc-team-manager-member-modal
        ref="itemList4"
        @ok="modalFormOk4"></erp-omc-team-manager-member-modal>
    </j-form-container>
  </a-spin>
</template>

<script>

import ErpOmcTeamManagerMemberModal from './ErpOmcTeamManagerMemberModal';
import ErpCompanyEmployeePostDetailList from '@/views/erp/files/company/ErpCompanyEmployeePostDetailList';

import { getAction, httpAction } from '@/api/manage'
import SelectUserByDep from '@/views/scy/components/SelectUserByDep'
import SelectTeamInput from '@/views/scy/components/SelectTeamInput'
import { mapGetters } from 'vuex';
import moment from 'moment';
import { filterMultiDictText, initDictOptions } from '@comp/dict/JDictSelectUtil';
import JMultiSelectTag from '@comp/dict/JMultiSelectTag'
import ErpOmcTeamManagerDetailList from './ErpOmcTeamManagerDetailList' // 子表列表
import ErpTeamApproval from './ErpTeamApproval' // 
import SelectCompanyInput from '@/views/scy/components/SelectCompanyInput'
export default {
  name: 'ErpOmcTeamManagerForm',
  components: {
    ErpOmcTeamManagerMemberModal,
    ErpCompanyEmployeePostDetailList,
    SelectUserByDep,
    JMultiSelectTag,
    SelectTeamInput,
    ErpOmcTeamManagerDetailList,
    SelectCompanyInput,
    ErpTeamApproval
  },
  props: {
    //表单禁用
    disabled: {
      type: Boolean,
      default: false,
      required: false
    },
    id:{
      type: String,
      default: '',
      required: false
    }
  },
  data() {
    return {
      activeKey: ['1', '2', '3', '4'],
      teamLeve:'',
      pagination: {
        current: 1,
        pageSize: 10,
        pageSizeOptions: ['10', '20', '30', '50', '100', '200'],
        showTotal: (total, range) => {
          return range[0] + '-' + range[1] + ' 共' + total + '条'
        },
        showQuickJumper: true,
        showSizeChanger: true,
        total: 0,
        onChange: (current) => {
          this.pagination.current = current;
        }
      },
      model: {
        zt: 1,
        ggyw: 0
      },
      labelCol: {},
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 24 },
      },
      confirmLoading: false,
      loading: false,
      dataSource4: [], // 团队成员
      columns4: [
        {
          title: '序号',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender: function (t, r, index) {
            return parseInt(index) + 1;
          }
        },
        {
          title: '员工姓名',
          align: 'center',
          dataIndex: 'userId',
          customRender: (text) => {
            if (!text) {
              return ''
            } else {
              return filterMultiDictText(this.dictOptions['userId'], text + '')
            }
          }
        },
        {
          title: '员工编号',
          align: 'center',
          dataIndex: 'employeeNo',
        },
        {
          title: '员工性别',
          align: 'center',
          dataIndex: 'gender',
          customRender: (text) => {
            if (!text) {
              return ''
            } else {
              return filterMultiDictText(this.dictOptions['gender'], text + '')
            }
          }
        },
        {
          title: '入职日期',
          align: 'center',
          dataIndex: 'joinDate',
        },
        {
          title: '加入时间',
          align: 'center',
          dataIndex: 'joinTime',
        },
        {
          title: '所在岗位',
          align: 'center',
          dataIndex: 'mainPost',
          customRender: (text) => {
            if (!text) {
              return ''
            } else {
              return filterMultiDictText(this.dictOptions['mainPost'], text + '')
            }
          }
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          scopedSlots: {
            filterDropdown: 'filterDropdown',
            filterIcon: 'filterIcon',
            customRender: 'action'
          }
        }
      ],
      validatorRules: {
        tdmc: [
          { required: true, message: '请输入团队名称!' }
        ],
        tdnd: [
          { required: true, message: '请输入团队年度!' }
        ],
        businessType: [
          { required: true, message: '请输入业务类型!' }
        ],
        tdlx: [
          { required: true, message: '请输入团队类型!' }
        ],
        tdfzr: [
          { required: true, message: '请输入团队负责人!' }
        ],
        tdfg: [
          { required: true, message: '请输入团队分管领导!' }
        ],
        teamType: [
          { required: true, message: '请选择团队类别!' }
        ],
        belongCompanyId: [
          { required: true, message: '请选择归属公司!' }
        ]
      },
      dictOptions: {},
      url: {
        add: '/api/erp/omc/teammanager/erpOmcTeamManager/add',
        edit: '/api/erp/omc/teammanager/erpOmcTeamManager/edit',
        queryById: '/api/erp/omc/teammanager/erpOmcTeamManager/queryById',
        queryListByMainId: '/api/erp/omc/teammanager/erpOmcTeamManagerMember/queryListByMainId',
        generatedFormNumber: '/api/erp/base/generatedFormNumber'
      }
    }
  },
  computed: {
    formDisabled() {
      return this.disabled
    }
  },
  created() {
    this.initDictConfig();
    // 备份model原始值
    this.modelDefault = JSON.parse(JSON.stringify(this.model));
  },
  methods: {
    initDictConfig() {
      /**
       * 初始化性别
       */
      initDictOptions('gender').then((res) => {
        if (res.success) {
          this.$set(this.dictOptions, 'gender', res.result)
        }
      })
      /**
       * 初始化岗位
       */
      initDictOptions('sys_position,name,id').then((res) => {
        if (res.success) {
          this.$set(this.dictOptions, 'mainPost', res.result)
        }
      })
      /**
       * 初始化用户名
       */
      initDictOptions('erp_employee_file,name,id').then((res) => {
        if (res.success) {
          this.$set(this.dictOptions, 'userId', res.result)
        }
      })
    },
    handleAdd4() {
      this.$refs.itemList4.add();
      this.$refs.itemList4.title = '新增';
      this.$refs.itemList4.disableSubmit = false;
    },
    handleDelete4(record) {
      for (let i = 0; i < this.dataSource4.length; i++) {
        if (this.dataSource4[i].id == record.id) {
          this.dataSource4.splice(i, 1);
        }
      }
    },
    handleEdit4(record) {
      this.$refs.itemList4.edit(record);
      this.$refs.itemList4.title = '修改';
      this.$refs.itemList4.disableSubmit = false;
    },

    ...mapGetters(['userInfo']),
    generatedFormNumber() {
      getAction(this.url.generatedFormNumber, { prefix: 'TDBH' , subSystemCode: '05' }).then(res => {
        if (res.success) {
          this.$set(this.model, 'tdbh', res.result)
        }
      })
    },
    modalFormOk4(data) {
      if (this.dataSource4 && this.dataSource4.length) {
        var isRepetition = this.dataSource4.some(function(el) {
          return (el.userId == data.userId)
        })
        if (isRepetition) {
          this.$message.warning('请勿重复添加');
          return false
        }
      }
      this.loading = true;
      let flag = true;
      if (this.dataSource4.length > 0 ) {
        // debugger;
        for (let i = 0; i < this.dataSource4.length; i++) {
          if (this.dataSource4[i].id == data.id) {
            this.dataSource4.splice(i, 1, data);
            flag = false;
          }
        }
      }
      if (flag) {
        this.dataSource4.push(data);
      }
      if (this.dataSource4.length) {
        this.pagination.current = Math.ceil(this.dataSource4.length / this.pagination.pageSize)
      }
      this.loading = false;
    },
    add(parentId) {
      this.dataSource4 = []
      if(parentId) {
        this.modelDefault.parentId = parentId
      } else {
        this.modelDefault.parentId = ''
      }
      this.edit(this.modelDefault);
      this.userName = this.userInfo().empName;//申请人名称
      this.model.proposer = this.userInfo().empId; //申请人
      this.model.proposerDeptId = this.userInfo().deptId; //申请部门
      this.model.createTime = moment().format('YYYY-MM-DD HH:mm');
      this.generatedFormNumber();
      this.$refs.managementPerson.dataSource = []
        this.$refs.teamPerson.dataSource = []
        this.$refs.teamResponsibilitiesPerson.dataSource = []
    },
    edit(record) {
      this.$refs.form.resetFields();
      this.model = Object.assign({}, record);
      if (this.model.teamLevel) {
        this.teamLeve = this.model.teamLevel
      }
      if (this.model.id) {
        getAction(this.url.queryListByMainId, { mainId: this.model.id }).then((res) => {
          if (res.success) {
            this.dataSource4 = res.result || res.result.record || []
          }
        })
      }
      this.$nextTick(() => {
        this.$refs.managementPerson.mainId = this.model.id
        this.$refs.teamPerson.mainId = this.model.id
        this.$refs.teamResponsibilitiesPerson.mainId = this.model.id
        this.$refs.managementPerson.loadData()
        this.$refs.teamPerson.loadData()
        this.$refs.teamResponsibilitiesPerson.loadData()
      })

      if (this.model.zjje) { // 资金金额
        this.model.zjje = this.model.zjje / 100
      }

      if (this.model.byj) { // 备用金
        this.model.byj = this.model.byj / 100
      }

      if (this.model.yrje) { // 预入金额
        this.model.yrje = this.model.yrje / 100
      }

      if (this.model.yyje) { // 已用金额
        this.model.yyje = this.model.yyje / 100
      }

      if (this.model.ytje) { // 预提金额
        this.model.ytje = this.model.ytje / 100
      }

      if (this.model.kyje) { // 可用余额
        this.model.kyje = this.model.kyje / 100
      }

      if (this.model.syje) { // 剩余金额
        this.model.syje = this.model.syje / 100
      }

      if (this.model.ljhtbgje) { // 累计报告合同金额
        this.model.ljhtbgje = this.model.ljhtbgje / 100
      }
      if (this.model.sjlrbl) { // 上缴利润比例
        this.model.sjlrbl = this.model.sjlrbl / 100
      }
      if (this.model.sjglfbl) { // 上缴管理费比例
        this.model.sjglfbl = this.model.sjglfbl / 100
      }

      this.visible = true;
    },
    // 数组对象中的id拼接成字符串
    getIds(arr) {
      let ids = ''
      if (arr && arr.length) {
        ids = arr.map(item => item.employeeId).join(',')
        return ids
      } else {
        return ''
      }
    },

    submitForm() {
      var that = this;
      // 触发表单验证
      this.$refs.form.validate(valid => {
        if (valid) {
          if (!this.$refs.teamPerson.dataSource || !this.$refs.teamPerson.dataSource.length) {
            this.$message.warning('请选择团队负责人!')
            this.$emit('unButtonDisable');
            return false
          }
          that.confirmLoading = true;
          let httpurl = '';
          let method = '';
          httpurl += this.url.add;
          method = 'post';
          
          let model = {};
          Object.assign(model, this.model)
          if (model.zjje) { // 资金金额
            //this.$set(this.model,"yjhte",yjhte * 100)
            model.zjje = model.zjje * 100;
          }

          if (model.byj) { // 备用金
            //this.$set(this.model,"yjhte",yjhte * 100)
            model.byj = model.byj * 100;
          }

          if (model.yrje) { // 预入金额
            //this.$set(this.model,"yjhte",yjhte * 100)
            model.yrje = model.yrje * 100;
          }

          if (model.yyje) { // 已用金额
            //this.$set(this.model,"yjhte",yjhte * 100)
            model.yyje = model.yyje * 100;
          }

          if (model.ytje) { // 预提金额
            //this.$set(this.model,"yjhte",yjhte * 100)
            model.ytje = model.ytje * 100;
          }

          if (model.kyje) { // 可用金额
            //this.$set(this.model,"yjhte",yjhte * 100)
            model.kyje = model.kyje * 100;
          }

          if (model.syje) { // 剩余金额
            //this.$set(this.model,"yjhte",yjhte * 100)
            model.syje = model.syje * 100;
          }

          if (model.ljhtbgje) { // 累计报告合同金额
            //this.$set(this.model,"yjhte",yjhte * 100)
            model.ljhtbgje = model.ljhtbgje * 100;
          }

          if (model.sjlrbl) { // 上缴利润比例
            model.sjlrbl = model.sjlrbl * 100;
          }

          if (model.sjglfbl) { // 上缴管理费比例
            model.sjglfbl = model.sjglfbl * 100;
          }
          model.memberList = this.dataSource4;
          model.institutionManager = this.getIds(this.$refs.managementPerson.dataSource) // 管理机构负责人
          model.tdfzr = this.getIds(this.$refs.teamPerson.dataSource) // 团队负责人
          model.tdfg = this.getIds(this.$refs.teamResponsibilitiesPerson.dataSource)  // 团队分管负责人
          // 把三个数组对象合并成一个数组对象
          model.detailList = [...this.$refs.managementPerson.dataSource, ...this.$refs.teamPerson.dataSource, ...this.$refs.teamResponsibilitiesPerson.dataSource]
          httpAction(httpurl, model, method).then((res) => {
            if (res.success) {
              that.$message.success(res.message);
              that.$emit('ok');
            } else {
              that.$message.warning(res.message);
              that.$emit('unButtonDisable');
            }
          }).catch((error)=>{
            that.$emit('unButtonDisable');
          }).finally(() => {
            that.confirmLoading = false;
          })
        } else {
          that.$emit('unButtonDisable');
        }

      })
    },
  }
}
</script>
